'Because of' is generally followed by a static reason, e.g. "because of him", or otherwise must be followed by a gerund.
So yes, you must use the latter sentence that you wrote, or you could rewrite the first sentence as such:
"Because of air only being able to hold a certain amount of water vapor at a given temperature, dew begins to form on the ground as air cools."
Hope that helps!