In this problem, you are asked to find a vertical position of a ball when you are given its initial position on a spring. In both locations, the speed of the ball is zero.
If non-conservative forces are either known or small and if energy is converted from one form to another between the locations, then any time you relate speed and position of an object at two different points, conservation of energy is the most direct way to understand the problem.
In this case, you start out with stored energy in the compression of the spring and convert it to stored gravitational energy.