The sky is pretty much always brighter than the foreground, and the camera can only cover so much difference between bright and dark.
If you pointed the camera to the sky, it would think "wow thats bright" and raise the shutter speed to expose it correctly, and in turn render the forground dark.
If you pointed at the ground, it would think "wow thats dark" and lower the shutter to correctly expose it and in turn the sky will be too bright.
The only ways to counteract this is to use graduated filters on the camera, or shoot 2 or more shots from a tripod. One exposed for the sky and one for the foreground and merge them in software.