For this the phone has to be rooted and the mobile version of a ads-blocking HOSTS file can be used. Here is an example: http://free-software-for-android.github.io/AdAway/
For mobile data, the DNS server would be provided by the telco. IfYou can remove the browser will take a proxy, then a content-filtering proxy IP can be provided in the APN used by the telco. See FAQ at above link.