It's a fair question, and one I can't answer. Trek often indulges itself in broad, seemingly unrestricted magical powers dressed up in a sciency-sounding miniskirt. Talosians, Platonians, Thasians, Trelane, the Beta XII‑A entity, the shore-leave world, Sylvia and Korob.... They all magically do whatever the plot demands, whether it's controlling minds and bodies, transmuting matter at will, repeatedly healing mortal wounds back to 100% function at the drop of a hat, flying an entire planet around at starship speeds (somehow making sharp turns without ripping its atmosphere off or destabilizing its geology), spinning papier-mâché mannequins until they turn into sophisticated androids, and whatever else.
Somehow I accept most of it. But most of the time I try not to peek too hard behind the curtain, because sometimes there's just no credible way to "science the magic."