The verdict
Neither wins outright. Both are beginner-listed compound pushes that train the shoulders through shoulder flexion and elbow extension, with the triceps as secondary. The difference is the setup: the machine seats you with your back against a pad on a fixed path, so you can press heavy without balancing a load; the dumbbells stand you up with a weight in each hand, so each arm works alone and your trunk has to stay rigid. Pick the machine when balance or a missing rack is the limit, and the dumbbells when one side lags the other or you train with dumbbells only.
Muscles, equipment, force and level from the PasteLift exercise library records for the machine shoulder press and the standing dumbbell press. Sets and reps from the ACSM position stand, cited below.