This is available in ArcGIS Pro by using the adjust frame fitting strategy. You can read more about it here: Work with a legend—ArcGIS Pro | Documentation. If you create a legend by single clicking a point on the layout instead of drawing a box this fitting strategy is applied automatically.