For airliners the retractable gear saves tons of drag, but they also have things like winglets, and lots of smaller things like optimisation on the wing-root (airliners have smooth transitions here, trainers are sort of just square) that all reduce drag.
An airliner is also much less friendly to handle in a stall condition, while a trainer almost recovers on it's own. And similar for yaw stability, if you get the rudder a bit wrong in a trainer nothing much happens, while an airliner will typically start to oscillate. Both of these are solved on the airliner by electronics, a stick shaker or pusher to avoid the stall and a yaw damper to enhance stability. The Cessna 172 doesn't have any electronics involved in flying, only for navigation and those are optional.