<SYSTEM_TASK:>
Given the following text problem statement, write Python code to implement the functionality described below in problem statement
<END_TASK>
<USER_TASK:>
Problem:
Given a distance matrix, with similarity between various professors :
<ASSISTANT_TASK:>
Python Code:
import numpy as np
import pandas as pd
import scipy.cluster
data_matrix = load_data()
Z = scipy.cluster.hierarchy.linkage(np.array(data_matrix), 'ward')
cluster_labels = scipy.cluster.hierarchy.cut_tree(Z, n_clusters=2).reshape(-1, ).tolist()
<END_TASK>