Yes, cancer vaccines can both prevent and treat cancer. Preventive vaccines, like the HPV vaccine, protect against viruses that can cause cancer. Therapeutic vaccines aim to stimulate the immune system to attack cancer cells in the body. Examples include the Sipuleucel-T vaccine for prostate cancer.