Motion requirements first
If the application only needs extend and retract, a cylinder with cushions is hard to beat on cost and simplicity.
Multi-position moves, soft landings, or force feedback push you to an electric actuator with a servo or stepper drive.
Total cost of the move
Compressed air is the most expensive utility in most plants. Over a few million cycles the electric option often wins even with a higher up-front price.