code: def to_matrix(np_array):
      """Convert numpy array to MLlib Matrix"""
      if len(np_array.shape) == 2:
          return Matrices.dense(
              np_array.shape[0], np_array.shape[1], np_array.ravel()
          )
      else:
          raise Exception(
              "An MLLib Matrix can only be created from a two-dimensional "
              + "numpy array, got {}".format(len(np_array.shape))
          )
  
imports: from pyspark.mllib.linalg import Matrices, Vectors
label_desc: Use image node_id 2 for calling a global function with example usage: to_matrix(np_array) and returns: Matrices