Introduction to the Spatially Enabled DataFrame | ArcGIS for Developers
I don't see where you imported "arcpy"
The ArcGIS API for Python installs on all macOS
and Linux
machines, as well as those Windows
machines not using Python interpreters that have access to ArcPy
will only be able to write out to shapefile format with the to_featureclass
method. Writing to file geodatabases requires the ArcPy
site-package.
The arcgis module performs checks to see whether arcpy is imported, If it is, then you can write to featureclasses, If it isn't then it uses the "shapely" module which can only write shapefiles.
You can examine all the revealed code in your installation path
C:\Path_to_ArcGISPro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis
Your particular method is described in
C:\Path_to_ArcGISPro\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\features\_data\geodataset\geodataframe.py
The SpatialDataFrame class has the to_featureclass method which imports to_featureclass from the _io module
C:\...\bin\Python\envs\arcgispro-py3\Lib\site-packages\arcgis\features\_data\geodataset\io\fileops.py
The to_featureclass method, checks to see if arcpy is installed (around line 400), if so, it can create a featureclass in a gdb.
So in short, just see if adding
import arcpy
to your script allows you to save to a featureclass
... sort of retired...