As energy and work both are measured in joules. If we define work it is the force applied on an object as it moves a certain distance and Energy is the ability to do work. Both are closely related because work done on an object can cause a change in energy. Now if a ball is rolling down a hill then there is no frictional loss then its energy will be conserved but the work done by the ball will continuously change.Therefore they will both be measured in joules.