However, most of the time you can get out by just wiggling around untill you escape.
Also, look at your thrust to weight ratio in build mode (bar up top), if your thrust is lower than your weight you wont have enough power to lift off from the planet, add more thrusters or decrease the weight...