Yes, you can. However, the baking time might vary depending on the size and type of the dish. A deeper pan may require a longer baking time, while shallow pans might bake more quickly, so keep an eye on the cake and test for doneness accordingly.