At least for unjailbroken devices I can assure you that this can't be done with the current APIs. Otherwise Apps like Connectivity Shortcuts and Network Dashboard would use this instead of linking to the settings pages.
It might be possible with a jailbreak but as of today i have no App that managed to change those settings programmatically.
What would be killer is to have the phone toggle "ON" wifi when you are at home based on your GPS location. And automatically turn it "OFF" when you were no longer within range.
Its really frustrating as this should be simple for MSFT to implement and this functionality works really well on Android.
I love it that my phone turns the bluetooth on for me to drive to work and BT off and the Wifi on when I get home.....