code: public static List<List<Writable>> toRecords(DataSet dataSet) {
          if (isClassificationDataSet(dataSet)) {
              return getClassificationWritableMatrix(dataSet);
          } else {
              return getRegressionWritableMatrix(dataSet);
          }
      }
docs: Convert a DataSet to a matrix
  @param dataSet the DataSet to convert
  @return the matrix for the records