How to think about them? The difference is in the little word at the end. In these two instances, the meaning of “obtained” doesn’t change, but the preposition changes the whole expression. You could even use both ideas together: “X is obtained from Y by Z.”
@stanleybmanly, yes. Method (process) or agent.
Both call for nouns (even if a verbal noun) because both “from” and “by” are prepositions requiring a noun as object.
They’re not indirect. They’re just passive. In many contexts, especially technical, this is just fine.