My shooting and reloading buddies and I have had this discussion over the years. If you are asking will they interchange as far as size?" Yes. Is it a smart thing to do. Most probably not. Could you do it? Anyone with enough determination can do most anything humanly possible.
Rifle primers in pistol cartridges could possibly raise the pressures to high.
Pistol primers in a rifle could lower them to far and the bullet could lodge in the barrel.
Neither is good on your hands face or firearm
If I absolutely positively had to load something for a life or death situation and all I had was the opposite primer would I use it? Yes.