When working with editor utilities sometimes you need an object type that isn't a "BlueprintType". This makes your life hard, because you can't cast to it.
Don't fear: Create an ExecutePythonScript node with an input and an output and link em.
In the above example, UFactory is not a blueprint type, so we can only construct it as a UObject. Then we can't cast it regularly, so we use the ExecutePythonScript to skip past that issue and plug it into CreateAsset which wants a factory directly.
Just to make sure it's clear. You only have access to the ExecutePythonScript in EditorUtilityWidgets and EditorUtilityObjects, it won't work at runtime, and you shouldn't want it to.
If you want this to work like an actual cast, and not just crash when the cast fails:
Addendum in the CreateAsset case, there are other ways around this that don't feel like you are committing crimes:
I break down the material functions and more in the post, but I am also sharing the project files outright, so you can get a head start implementing these different techniques in your projects.