What did Mayu Yamamoto do with/from cow droppings?

1. She invented a way to make vanilla flavor from cow droppings.

2. She invented a way to make vanilla flavor with cow droppings.

(Are both answers grammatical? Do we have to use 'with' or 'from' in both the question and the answer?)

Both are fine. Use either one.