The thermal energy of an object is the energy contained in the motion and vibration of its molecules. Thermal energy is measured through temperature.
Temperature is a direct measurement of thermal energy, meaning that the hotter an object is, the more thermal energy it has. Heat is a measure of how much thermal energy is transferred between two systems.
It is easy to turn mechanical energy into thermal energy, for example using friction. It's also possible to turn thermal energy into mechanical energy by using a heat engine, but there will always be waste heat with this method.
The latent heat of a substance is the heat required for an object to change states, also called a phase change. Generally speaking, values for latent heats are much higher than those for specific heat. This is also referred to as enthalpy.
Ice and water have enormous latent heats associated with them, which is why snow takes so long to melt and water is used for cooking. This is also important in keeping our planet comfortable to live on, and provides a fair amount of resistance to climate change.
The University of Colorado has graciously allowed us to use the following PhET simulation. Explore the simulation below to get a physical intuition of how friction can increase thermal energy and turn macroscopic motion into microscopic.