I'm assuming Data doesn't need to go number 1 or 2, but an android's bioplast sheeting (his skin) can and has been seen dirty on-screen (in Star Trek: Nemesis, B-4 was found quite dirty from dust/dirt).
How does Data keep himself appearing clean?
Science Fiction & Fantasy Stack Exchange is a question and answer site for science fiction and fantasy enthusiasts. It only takes a minute to sign up.Sign up to join this community
As there are no legitimate case examples in the canon stating that Data is incapable of using normal tools/methods for his personal hygiene, it is reasonable enough to suggest that he simply uses a sonic shower like the rest of his crew mates. I can't find any reference which states that Data is somehow damaged or susceptible to some negative effect from sonic waves. Even if this were the case, there would always be the option for him to simply use water to remove said dirt/dust/grime. From what I understand of Data's composition, he has a fully enclosed artificial integumentary system which, though it doesn't perfectly simulate human skin, does protect the parts of his internal framework. Also, though Data is not completely waterproof, that wouldn't stop him from actually washing the surface of his skin if he kept any orifices sealed (just like we as humans should probably not take deep breaths underneath the water while take a bath). In fact, there are several times in the series which show him fully capable of operating while wet, even when submerged.
I'm not seeing any sparks shooting out of his ears here...
Now, the argument against his ability to use water might be that "there are no water showers/sources of water for cleanliness on the Enterprise!" However, that would be a wrong assessment of the situation as well. There are multiple examples throughout the franchise of water being used as a method of hygiene: Captain Archer had his infamous shower malfunction, the first scene of Neelix actually on Voyager was one in which he bathed water, captain Janeway had her own personal bathtub, etc, etc. However, the one example that is most relevant would be the fact that Dianna Troi had a bathtub in her quarters (which she was pictured as starting devolving into an amphibian in) on the Enterprise. It wouldn't be to far of a stretch for Data to have one too if need be.
I hope this helped a little. If Data used some other kind of device or method for keeping clean, there isn't any reference I can find that states so, and the evidence would seem to suggest that he is capable of using the exact same facilities that his biological counterparts use as well.