If the tooth decay hasn't caused the cavity to be too severe then the cavity can be treated at home by oil pulling with coconut oil and brushing your teeth with fluoride based toothpaste.
Another good toothpaste that can heal cavities naturally at home without seeing a dentist is the Demic Toothpaste.
Demic Toothpaste bonds to the teeth and fills in cavities naturally.
Once you've reversed the cavity you should rinse your mouth out using Apple Cider Vinegar which can kill the bacteria and even oil pull a few times per week with coconut oil.
If a cavity becomes too severe then a dentist will have to fill it in.