Sort of/it depends. You’ll need to do a bit of research/math as well.
peppermint essential oils have different menthol percentages. Say a recipe calls for 3g of menthol, and your peppermint essential oil is 50% menthol. That means that 3g of peppermint essential oil will contain 1.5g of menthol, so you’d need to use 6g of peppermint essential oil in the recipe to have an equivalent amount of menthol in the final product. You are, of course, also bringing an extra 3g of other pepperminty things to the recipe that were not originally accounted for when the formula was developed. In small amounts this usually isn’t a problem, but it’s still a consideration.
Peppermint essential oil is often liquid (especially if it’s relatively low in menthol) and menthol is solid, so now you’re using a lot of liquid in place of a small amount of solid.
We’ll use menthol in a recipe where we want concentrated cooling, and little else. Peppermint essential oil contains menthol, but it also contains other things that make it smell like peppermint, and because you’ll always need more peppermint essential oil than menthol, your final product will smell a lot like peppermint.
So… use your judgement, basically 🙂 It can be done, but there are some considerations to be made.