While studying energy on Sears & Zemansky's University Physics, I came up with a doubt on the meaning of kinetic energy. The book gives two possible physical interpretations of this quantity.
So the kinetic energy of a particle is equal to the total work that was done to accelerate it from rest to its present speed [...] The kinetic energy of a particle is equal to the total work that particle can do in the process of being brought to rest.
I'm okay with the first meaning of KE but I don't understand completely the second one. How can the particle do work?
If we take a ball with velocity $v$ that meets a spring, the spring is compressed and the ball is stopped. But here it's the spring that does work on the ball, or vice-versa? The ball gains potential energy ($W_\textrm{spring}=-\Delta U_\textrm{ball}$) and mechanical energy is conserved in the process. Nevertheless I do not see if and where the ball does work here.