You can find NURBs fitting in decades old textbooks (such as "The NURBs book"), but you have to be aware that this is an approximation problem as the only exact fitting is the one where the output is the input.
Also prone to robustness and quality issues. You're better off outputing a BREP directly.
Also prone to robustness and quality issues. You're better off outputing a BREP directly.