Joule's experiments amply demonstrate that energy, when supplied to a system in the form of work, can be completely converted into heat
When work is done on a system or work transfer, this work has an effect of increase in internal energy.
The internal energy of the system is a function of temperature and hence temperature increases due to the internal energy increase.
Any process which leads to increase in temperature is a heat transfer process.
Joule found that the work found is completely converted to heat. Thus, when work is converted into heat, we always have W = Q