Absolutely. They have similar textures and mild flavors that work well in many recipes. Just remember that it's a 1 to 1 substitution. For 1 cup of sweet potato, you can substitute 1 cup of pumpkin and vice versa.