code: def to_data_frame(sc, features, labels, categorical=False):
      
      lp_rdd = to_labeled_point(sc, features, labels, categorical)
      sql_context = SQLContext(sc)
      df = sql_context.createDataFrame(lp_rdd)
      return df
docs: Convert numpy arrays of features and labels into Spark DataFrame