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. You can remove the proxy provided in the APN used by the telco. See FAQ at above link.