It difficult to know what may have happened exactly. Did they live together with no issues for some time? Or were they new to each other? Here are just a few possibilities: your dog had pain somewhere and redirected by lashing towards the cat, the cat went close to your dog's resource, maybe your cat had some sort of seizure you weren't aware of, your cat smelled different from being at the vet or someplace else, they were playing and your dog got too rough, your dog has been stressed lately, he wasn't trustable near cats in the first place and he learned not to attack in your presence but the moment you moved away he attacked, the cat entered the dog's territory, the dog is protective of you or a family member, the cat did something that triggered the dog's prey drive. Of course, there are many more possibilities. So sorry this has happened.