Use the latter if you can identify the force as a function of displacement. If you are worrying about the difference between work and energy, don't be. The difference is only semantic. We say that work is done to something. We say that energy is stored in something.
Energy is simply the capability to do work.
Units Now let's get quantitative. Joules are a unit of energy or work . Watts are a unit of power . Power is a rate of delivery of energy, just as velocity is a rate of delivery of distance. It is also very important for this discussion to bear in mind that the force shown is the force applied to the spring or the damper, not the force that the spring or damper applies to whatever it is conected to.